<script type="text/javascript">
var content = null;
$(function () {
	var url = '${contextPath}script/site/indexAdvertising.js?time=' + sys_get_time();
	$.ajax({url:url, dataType:'script', cache:true,
		success: function(){
			addFilesUploadEvent();
			if(CKEDITOR.instances['content']) 
				CKEDITOR.remove(CKEDITOR.instances['content']);
			var uploadParm = {
				height:'150px',
				filebrowserBrowseUrl:'${contextPath}browse-file.html',
				filebrowserImageBrowseUrl:'${contextPath}browse-image.html',
				filebrowserUploadUrl:'${contextPath}m/organactivities-upload.html?type=file',
				filebrowserImageUploadUrl:'${contextPath}m/organactivities-upload.html?type=image',
				language:'zh-cn'
			}
			
			content = CKEDITOR.replace('content', uploadParm);
		}
	});
});

</script>

<div class="widget" style="float:left;">
	<div class="widget-header">
		<h3 class="title"><i class="fontello-icon-th-list-1"></i>编辑首页广告</h3>
	</div>
	<div class="widget-content">
		<form id="editIndexAdvertisingForm">
			<input type="hidden" name="rec" value="${(ia.code)!''}" />
			<input type="hidden" name="code" value="${(ia.code)!''}" />
			<input type="hidden" name="pt" value="${(ia.pt)!''}"/>
			<input type="hidden" name="fileCode" id="fileCode" /> 
			<table class="table boo-table table-content" style="width:100%; text-align:left;">
				<tr>
					<td class="table-left" style="width:100px;">标题</td>
					<td><input type="text"   name="title" style="width:600px;" value="${(ia.title)!''}" /></td>
				</tr>
				<tr>
					<td class="table-left">内容</td>
					<td><textarea id="content"  style="width:600px;">${(ia.content)!''}</textarea></td>
				</tr>
				<tr>
					<td class="table-left">附件(选中的为封面图片)<a id="uploadFilesBtn" href="javascript:;">[选择]</a></td>
					<td id="annexListIa">
					<#if list??>
					<#list list as iaa>
					<div class="filter-table rep" style="margin-left:5px; margin-bottom:0px;">
						<input type="hidden" name="list[${iaa_index}].code" value="${iaa.code}" />
						<input type="radio" name="choose"  value="${iaa.code}" <#if iaa.cover=="true">checked="checked"</#if> />
						<button type="button" class="close" data-dismiss="alert" onclick="javascript:deleteSelectedItem($(this));">&times;</button>
						<a class="title" target="_blank" href="${contextPath}upload/indexAdvertisingAnnex/${iaa.sn}.${iaa.ext}">${iaa.name}</a>
					</div>
					</#list>
					</#if>
					</td>
				</tr>
				<tr>
					<td class="table-left" style="width:100px;">发表人</td> 
					<td><input type="text"  name="pm" style="width:150px;" value="${(ia.pm)!''}" /></td>
					
				</tr>
				<td class="table-left" style="width:100px;">排序</td> 
					<td><input type="text"  name="sort" style="width:150px;" value="${(ia.sort)!''}" /></td>
				<tr>
					<td colspan="2" style="text-align:center;">
						<a href="javascript:;" class="btn btn-info" onclick="javascript: saveIndexAdvertising();">
							<i class="fontello-icon-mail-4"></i>&nbsp;保&nbsp;&nbsp;存
						</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<a href="javascript:;" class="btn btn-info" onclick="javascript: sys_load_handle('indexadvertising');">
							<i class="fontello-icon-block"></i>&nbsp;取&nbsp;&nbsp;消
						</a>
					</td>
				</tr>
			</table>
		</form>
	</div>
</div>


<div id="tempAnnexListDiv" style="display:none;">
	<div class="filter-table rep" style="margin-left:5px; margin-bottom:0px;">
		<input class="name" type="hidden" />
		<input class="size" type="hidden" />
		<input class="sn" type="hidden"  />
		<input class="ext" type="hidden"  />
		<input class="afcs" type="hidden" name="afcs"  />
		<input type="radio" name="choose" class="font-cover"  checked="checked" />
		<button type="button" class="close" data-dismiss="alert" onclick="javascript:deleteSelectedItem($(this));">&times;</button>
		<a class="title" href="#"></a>
	</div>
</div>

<input type="hidden" id="indexadvertising_an_index" value="${(list?size)!'0'}" />
